﻿using System.Collections.Generic;
using Amazon.SimpleDB.Model;
using System.Linq;

namespace CsiroCloudAggregator.User.Object {

    public class GetAwsUserAccountsResponse {
        
        public List<AwsUserAccount> UserAccounts {  get; set; }
        public List<AwsUserAccount> AwsUserAccounts { get; set; }

        public GetAwsUserAccountsResponse(SelectResponse selectResponse) {
            AwsUserAccounts = selectResponse.IsSetSelectResult() ? selectResponse.SelectResult.Item.Select(item => AwsUserAccountHelper.CreateAwsUserAccount(item)).ToList() : new List<AwsUserAccount>();
        }

        public List<AwsUserAccount> GetUserAccountsResponse(SelectResponse selectResponse) {
            if (selectResponse != null)
                if (selectResponse.IsSetSelectResult()) {
                    return selectResponse.SelectResult.Item.Select(item => AwsUserAccountHelper.CreateAwsUserAccount(item)).ToList();
                }
            return new List<AwsUserAccount>();
        }
    }
}
